<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" href="css/index.css" />
</head>

<body>
	<a href="file://f:/housesfiles/h_1656316953682.jpg/"></a>
	<div id="app">
		<el-form ref="loginform" :model="adminsObj" label-width="100px" style="width:500px">
			<!-- <el-form-item label="管理员编号">
				<el-input v-model="adminsObj.adminsId"></el-input>
			</el-form-item> -->
			<el-form-item label="用户名" :prop="adminsId" :rules="[{ required: true, message: '请输入用户名', trigger: 'blur' }]">
				<el-input v-model="adminsObj.adminsId" :maxlength="16" placeholder clearable></el-input>
			</el-form-item>
			<el-form-item label="管理员密码">
				<el-input v-model="adminsObj.adminsPwd" type="password"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="login">登陆</el-button>
			</el-form-item>
		</el-form>
		{{msg}}


	</div>
	<script type="text/javascript" src="js/vue.js"></script>
	<script type="text/javascript" src="js/index.js"></script>
	<script type="text/javascript" src="js/axios.min.js"></script>

	<script type="text/javascript" src="js/common.js"></script>
	<script type="text/javascript">
		new Vue({
			el: "#app",
			data: {
				adminsId:"",
				adminsObj: {
					adminsId: "",
					adminsPwd: ""
				},
				msg: ""
			},
			methods: {
				login: function () {
					let that = this;
					let str = "adminsId=" + this.adminsObj.adminsId + "&adminsPwd=" + this.adminsObj.adminsPwd;
					console.log(str);
					//get请求传递的参数
					axios.get("/admins/checkLogin?" + str).then(function (r) {
						console.log(r.data);
						if (r.data.state == "success") {
							//跳转页面
							//alert("ok");
							location.href = "index.html";
							that.msg = "";
						} else {
							//给msg赋值
							that.msg = "登陆失败";
						}
					});
				}
			}

		});



	</script>



</body>

</html>